#include <bits/stdc++.h>
using namespace std;
#include <atcoder/maxflow>
using namespace atcoder;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int a[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  mf_graph<int> graph(n * m + 2);
  vector<string> s(n);
  rep(i, 0, n - 1) cin >> s[i];
  int S = n * m, T = n * m + 1;
  rep(i, 0, n - 1) {
    rep(j, 0, m - 1) {
      if ((i + j) % 2 == 0 && s[i][j] == '.') {
        if (i > 0 && s[i - 1][j] == '.') {
          graph.add_edge(i * m + j, (i - 1) * m + j, 1);
        }
        if (i < n - 1 && s[i + 1][j] == '.') {
          graph.add_edge(i * m + j, (i + 1) * m + j, 1);
        }
        if (j > 0 && s[i][j - 1] == '.') {
          graph.add_edge(i * m + j, i * m + j - 1, 1);
        }
        if (j < m - 1 && s[i][j + 1] == '.') {
          graph.add_edge(i * m + j, i * m + j + 1, 1);
        }
        graph.add_edge(S, i * m + j, 1);
      } else if ((i + j) % 2 == 1 && s[i][j] == '.') {
        graph.add_edge(i * m + j, T, 1);
      }
    }
  }
  int max_flow = graph.flow(S, T);
  const auto& edges = graph.edges();
  for (const auto& e : edges) {
    if (e.from == S || e.to == T || e.flow == 0) continue;
    int x1 = e.from / m, y1 = e.from % m;
    int x2 = e.to / m, y2 = e.to % m;
    if (x1 == x2) {
      if (y1 > y2) swap(y1, y2);
      s[x1][y1] = '>';
      s[x2][y2] = '<';
    } else {
      if (x1 > x2) swap(x1, x2);
      s[x1][y1] = 'v';
      s[x2][y2] = '^';
    }
  }
  cout << max_flow << endl;
  rep(i, 0, n - 1) cout << s[i] << endl;
  return 0;
}